package com.lzy.business.multiple;

import com.lzy.base.apis.SysIdentityServiceApi;
import com.lzy.base.dtos.SysIdentityDto;
import com.lzy.framework.core.datasource.multiple.DataSource;
import com.lzy.framework.core.datasource.multiple.DataSourceHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ellengou
 * Date: 2017-12-11
 * Time: AM 10:19
 */
@Component
public class MultipleDatasourceService {

    @Autowired
    SysIdentityServiceApi sysIdentityServiceApi;

    @DataSource(name = DataSource.DATASOURCE_COMMON)
    public List<SysIdentityDto> getList() {
        return sysIdentityServiceApi.getList();
    }

    @DataSource(name = DataSource.DATASOURCE_COMMON)
    public SysIdentityDto getById(Long id) {
        return sysIdentityServiceApi.getById(id);
    }
}
